<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/system/include/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>性能测试</title>
<link rel="stylesheet" type="text/css" href="${jsAndCss}/css/style.css" />
<script type="text/javascript" src="${jsAndCss}/js/jquery.js"></script>
</head>
<body>
	<div id="container" style="position:relative;">
		<div>
			<span style="margin:50px 50px 50px 50px">数量：</span><input id="frequency" type="text" style="margin:30px 10px 30px 10px;width:50px" value=""/>
			<span style="margin:50px 50px 50px 50px">成功：</span><input id="success" type="text" style="margin:30px 10px 30px 10px;width:50px" value="0"/>
			<span style="margin:50px 50px 50px 50px">失败：</span><input id="fail" type="text" style="margin:30px 10px 30px 10px;width:50px" value="0"/>
			<span style="margin:50px 50px 50px 50px">count：</span><input id="count" type="text" style="margin:30px 10px 10px 10px;width:50px" value="0"/>
		</div>
		<div>
			<input type="button" onclick="clickMgr.addAccount();" value="批量增加账号" style="margin:10px 10px 10px 50px"/>
		</div>
		
	</div>
<script>
	var clickMgr={
			
			addAccount:function(){
				alert("批量增加账号"+$("#frequency").val()+"个！");
				var frequency = $("#frequency").val();
				var success = 0;
				var fail = 0;
				var countFlag = 0;
				/* alert("frequency"+(parseInt(frequency)+1)); */
				for(var i=1;i<parseInt(frequency)+1;i++){
					$.ajax({
						type:'post',
						url:'${ctx}/addAccountTest',
						dataType:'json',
						data:{"loginName":"${account.loginName}"+i,"password":"111111","countFlag":i},
						success:function(data){
							success +=1;
							$("#success").val(success); 
							$("#count").val(data.count);
						},
						error:function(data){
							fail +=1;
							$("#fail").val(fail);
							$("#count").val(data.count);
						}
					});
				};
				
			},
			
	};
</script>	
	
</body>
